<!-- 小区详情 -->
<template>
  <s-layout title="小区详情" class="set-userinfo-wrap">
    <uni-forms :model="state.model" labelPosition="left" labelWidth="200" border class="form-box">
      <view class="ss-flex ss-row-center ss-col-center ss-p-t-60 ss-p-b-0 bg-white">
        <view class="header-box-content">
          <su-image class="content-img" isPreview :current="0"
            :src="state.model?.logo ? state.model?.logo: sheep.$url.static('https://txz-1332973494.cos.ap-guangzhou.myqcloud.com/static/img/shop/txz.jpg')"
            :height="160" :width="160" :radius="80" mode="scaleToFill" />
        </view>
      </view>
      <view class="bg-white ss-p-x-30">
        <uni-forms-item name="name" label="社区名称">
          <uni-easyinput v-model="state.model.name" type="text" disabled :inputBorder="false"
            :placeholderStyle="placeholderStyle" />
        </uni-forms-item>
        <uni-forms-item name="userName" label="社区主理人">
          <uni-easyinput v-model="state.model.userName" type="text" disabled :inputBorder="false"
            :placeholderStyle="placeholderStyle" />
        </uni-forms-item>
        <uni-forms-item name="introduction" label="社区简介">
          <uni-easyinput v-model="state.model.introduction" type="textarea" disabled :inputBorder="false"
            :placeholderStyle="placeholderStyle" />
        </uni-forms-item>
        <uni-forms-item name="areaName" label="社区所在地区">
          <uni-easyinput v-model="state.model.areaName" type="text" disabled :inputBorder="false"
            :placeholderStyle="placeholderStyle" />
        </uni-forms-item>
        <uni-forms-item name="detailAddress" label="社区详细地址">
          <uni-easyinput v-model="state.model.detailAddress" type="textarea" disabled :inputBorder="false"
            :placeholderStyle="placeholderStyle" />
        </uni-forms-item>
      </view>
    </uni-forms>
  </s-layout>
</template>

<script setup>
  import {
    computed,
    reactive,
    onBeforeMount
  } from 'vue';
  import {
    onLoad

  } from '@dcloudio/uni-app';
  import sheep from '@/sheep';
  import {
    clone
  } from 'lodash-es';
  import MgrApi from '@/sheep/api/mgr';

  const state = reactive({
    model: {}, // 详情
  });

  const placeholderStyle = 'color:#BBBBBB;font-size:28rpx;line-height:normal';



  // 获取小区详情
  const getInfo = async (id) => {
    let {
      data
    } = await MgrApi.getVillageMgrDetail({
      id
    })
    state.model = clone(data);
    console.log(state.model)
  };
  onLoad((options) => {
    getInfo(options.id)
  })
</script>

<style lang="scss" scoped>
  :deep() {
    .uni-file-picker {
      border-radius: 50%;
    }

    .uni-file-picker__container {
      margin: -14rpx -12rpx;
    }

    .file-picker__progress {
      height: 0 !important;
    }

    .uni-list-item__content-title {
      font-size: 28rpx !important;
      color: #333333 !important;
      line-height: normal !important;
    }

    .uni-icons {
      font-size: 40rpx !important;
    }

    .is-disabled {
      color: #333333;
    }

    .uni-forms-item__content {
      display: flex;
      align-items: center;
    }
  }

  :deep(.disabled) {
    opacity: 1;
  }

  .title {
    line-height: 1;
    font-size: 38rpx;
  }

  .gender-name {
    font-size: 28rpx;
    font-weight: 500;
    line-height: normal;
    color: #333333;
  }

  .title-box {
    font-size: 28rpx;
    font-weight: 500;
    color: #666666;
    line-height: 100rpx;
  }

  .logout-btn {
    width: 710rpx;
    height: 80rpx;
    background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
    border-radius: 40rpx;
    font-size: 30rpx;
    font-weight: 500;
    color: $white;
  }

  .post {
    border: 1px solid #666;
    line-height: 1;
    padding: 8rpx 12rpx;
    border-radius: 28rpx;
    font-size: 24rpx;
    margin-bottom: 4rpx;

    &.txt0 {
      color: #ff690d;
    }

    &.txt1 {
      color: #3077ee;
    }
  }

  .radio-dark {
    filter: grayscale(100%);
    filter: gray;
    opacity: 0.4;
  }

  .content-img {
    border-radius: 50%;
  }

  .header-box-content {
    position: relative;
    width: 160rpx;
    height: 160rpx;
    overflow: hidden;
    border-radius: 50%;
  }

  .avatar-action {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    z-index: 1;
    width: 160rpx;
    height: 46rpx;
    background: rgba(#000000, 0.3);

    .avatar-action-btn {
      width: 160rpx;
      height: 46rpx;
      font-weight: 500;
      font-size: 24rpx;
      color: #ffffff;
    }
  }

  // 绑定项
  .account-list {
    background-color: $white;
    height: 100rpx;
    padding: 0 20rpx;

    .list-img {
      width: 40rpx;
      height: 40rpx;
      margin-right: 10rpx;
    }

    .list-name {
      font-size: 28rpx;
      color: #333333;
    }

    .info {
      .avatar {
        width: 38rpx;
        height: 38rpx;
        border-radius: 50%;
        overflow: hidden;
      }

      .name {
        font-size: 28rpx;
        font-weight: 400;
        color: $dark-9;
      }
    }

    .bind-box {
      width: 100rpx;
      height: 50rpx;
      line-height: normal;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 24rpx;

      .bind-btn {
        width: 100%;
        height: 100%;
        border-radius: 25rpx;
        background: #f4f4f4;
        color: #999999;
      }

      .relieve-btn {
        width: 100%;
        height: 100%;
        border-radius: 25rpx;
        background: var(--ui-BG-Main-opacity-1);
        color: var(--ui-BG-Main);
      }
    }
  }

  .list-border {
    font-size: 28rpx;
    font-weight: 400;
    color: #333333;
    border-bottom: 2rpx solid #eeeeee;
  }

  image {
    width: 100%;
    height: 100%;
  }
</style>